Skip to main content

Accessing data from service locations and creating new service locations

A service location refers to a place in which BinBars are located. Service locations may contain many container sites.

A service location can be thought of as a geographical location. For example, a service location may refer to a factory or a town.

The specifics of how to name and organize service locations are up to you, but we recommend against broad service locations such as "East Coast" and "West Coast" as this will make specific data more difficult to query and organize

The primary purpose of service locations are as a reporting tool to better organize container sites

The container sites that belong to a service location are ones that are inside of that geographical location. Think of a service location as a logical grouping of container sites

For information on what can be queried refer to the service location documentation

How to create a new service location

1. Find your account's ID using the query currentUser

2. Create a new service location using the mutation createServiceLocation

Find your account's ID
query getAccountID {
currentUser {
account {
__typename
id
# Some 'Account' fields omitted for brevity
}
}
}
Create a new service location
mutation CreateServiceLocation($input: CreateServiceLocationInput!) {
createServiceLocation(input: $input) {
__typename
id
name
# Some 'serviceLocation' fields omitted for brevity
}
}

variables = {input: { name: 'My New Service Location', accountID: accountID }};
tip

When creating new service locations, it may be useful to query for that ID at the same time so you do not have to query for it later


Find all service locations

Using the query currentUser

Find all service locations
query currentUser {
currentUser {
account {
serviceLocations {
__typename
name
id
containerSites {
id
}
# Some 'serviceLocation' fields omitted for brevity
}
}
}
}
caution

Larger queries will take longer to retrieve. For larger queries, we recommend using the optional paginationInput. To learn more, visit Paginating Queries

tip

With the above query you can also find one service location with a particular container site or find all service locations that do not have any container sites


How to find a service location's information with an ID

Using the query serviceLocationByID

Find a service location by ID
query ServiceLocationByID($id: ID!) {
serviceLocationByID(id: $id) {
__typename
id
name
# Some 'serviceLocation' fields omitted for brevity
}
}

variables = { id: '123abc8972354nf5234a' };